<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Like
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 * @version    $Id: Level.php 2010-09-07 16:05 idris $
 * @author     Idris
 */

/**
 * @category   Application_Extensions
 * @package    Like
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 */

class Like_Form_Admin_Level extends Engine_Form
{
  public function init()
  {
  	$url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array(), 'admin_like_level');
  	
    $this
    	->setAction($url)
      ->setTitle('like_Like Settings')
      ->setDescription('like_FAN_FORM_ADMIN_LEVEL_DESCRIPTION');
      
		$levels = array();
    $table  = Engine_Api::_()->getDbtable('levels', 'authorization');
    foreach ($table->fetchAll($table->select()) as $row){
      $levels[$row['level_id']] = $row['title'];
    }

    $this->addElement('Select', 'level_id', array(
      'label' => 'like_Member Level',
      'multiOptions' => $levels,
    	'onChange' => 'form_redirect_level("'.$url.'", this)'
    ));
		    
    $this->addElement('Radio', 'create', array(
      'label' => 'like_Allow Like Club Creation?',
      'description' => 'like_FAN_FORM_ADMIN_LEVEL_VIEW_DESCRIPTION',
      'multiOptions' => array(
        0 => 'like_No, do not allow create like clubs.',
        1 => 'like_Yes, allow create like clubs.'
      )
    ));

    // Add submit button
    $this->addElement('Button', 'submit', array(
      'label' => 'Save Changes',
      'type' => 'submit',
      'ignore' => true
    ));
  }
}